#ifndef QGLOBALOBJECT_H
#define QGLOBALOBJECT_H

#include "shared_global.h"

#include <QObject>
#include <QGraphicsView>
#include <QMap>
#include <QGraphicsProxyWidget>

class SHAREDSHARED_EXPORT QGlobalObject : public QObject
{
    Q_OBJECT
protected:
    explicit QGlobalObject(QObject *parent = 0);
    ~QGlobalObject();

public:
    static QGlobalObject   *globalObject();
    static void             releaseGlobalObject();
    QMap<QString,QGraphicsProxyWidget*> pages();
    void                    updateGlobal();
public:
    void    setView(QGraphicsView* view);

protected:
    QWidget *createWidget(const QString &code);
signals:
    void    initProperty();
    void    initGlobal();
public slots:
    void    showPage(const QString &page);
    void    hidePage(const QString &page);
    bool    createPage(const QString &page);

    void    close();

    void    setMemeryData(const QString &key,const QVariant &value);
    QVariant memeryData(const QString &key);
public slots:

protected:
    static  QGlobalObject   *m_object;
    uint            m_zValue;
    QGraphicsView         *m_view;

    QMap<QString,QGraphicsProxyWidget*>  m_pages;
};

#endif // QGLOBALOBJECT_H
